﻿<!--
// This source is subject to Microsoft Public License (Ms-PL).
// Please see http://taskcardcreator.codeplex.com for details.
// All other rights reserved.
-->
<Window x:Class="TaskCardCreator.TaskCardDetailsPopup"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:l="clr-namespace:WorkItemReportInterface;assembly=WorkItemReportInterface"
        xmlns:Converters="clr-namespace:TaskCardCreator.Converters"
        xmlns:controlLibrary="clr-namespace:WpfControlLibrary;assembly=WpfControlLibrary" Title="Task Card Details" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False" Height="650" Width="500" Background="#FFE0EAF6" WindowStyle="SingleBorderWindow">
  <Window.Resources>
    <Converters:BoolToVisibleConverter x:Key="boolToVisibleConverter"/>
    <Converters:PaperTextConverter x:Key="paperTextConverter"/>
    <DataTemplate DataType="{x:Type l:IWorkItemReport}" x:Key="ReportTemplate">
      <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Path=Description}" />
        <TextBlock Foreground="Red" Text="*" Visibility="{Binding Path=TeamCustomized, Converter={StaticResource boolToVisibleConverter}}" />
        <Image Source="Resources\Paper.png" Margin="5,0,0,0" ToolTip="{Binding Path=PaperSize, Converter={StaticResource paperTextConverter}}" />
      </StackPanel>
    </DataTemplate>
  </Window.Resources>
  <Grid Margin="10">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="2*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="2*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="2*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Border Grid.Row="0" Margin="5,0,5,0">
      <Border.Background>        
        <LinearGradientBrush EndPoint="0,0" StartPoint="1,1">
          <GradientStop Color="#FFE0EAF6" Offset="0"/>
          <GradientStop Color="Wheat" Offset="1"/>
        </LinearGradientBrush>        
      </Border.Background>
      <TextBlock Margin="5">Select Template:</TextBlock>
    </Border>

    <Grid Grid.Row="1" Margin="5">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"></ColumnDefinition>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
      </Grid.ColumnDefinitions>
      <TextBlock Grid.Column="0" HorizontalAlignment="Left">
        <Hyperlink NavigateUri="http://taskcardcreator.codeplex.com/wikipage?title=Template%20Overview" RequestNavigate="Hyperlink_RequestNavigate">Read more about the different templates</Hyperlink>
      </TextBlock>
      <StackPanel Grid.Column="1" Orientation="Horizontal">
        <TextBlock Foreground="Red" Text=" * " />
        <TextBlock Text="Team customized" />
      </StackPanel>
    </Grid>

    <ListBox Grid.Row="2" Margin="5" ItemsSource="{Binding Reports}" SelectedValue="{Binding SelectedReport}" ItemTemplate="{StaticResource ReportTemplate}" />

    <Border Grid.Row="3" Margin="5,0,5,0">
      <Border.Background>
        <LinearGradientBrush EndPoint="0,0" StartPoint="1,1">
          <GradientStop Color="#FFE0EAF6" Offset="0"/>
          <GradientStop Color="Wheat" Offset="1"/>
        </LinearGradientBrush>
      </Border.Background>
      <TextBlock Margin="5">Select Work Item Query:</TextBlock>
    </Border>

    <controlLibrary:WorkItemsQueriesControl Grid.Row="4" Margin="5" HorizontalAlignment="Stretch" Name="queries" SelectionChanged="queries_SelectionChanged" />

    <Border Grid.Row="5" Margin="5,0,5,0">
      <Border.Background>
        <LinearGradientBrush EndPoint="0,0" StartPoint="1,1">
          <GradientStop Color="#FFE0EAF6" Offset="0"/>
          <GradientStop Color="Wheat" Offset="1"/>
        </LinearGradientBrush>
      </Border.Background>
      <TextBlock Margin="5">Select Work Items:</TextBlock>
    </Border>
    
    <Grid Grid.Row="6">
      <ListView Margin="5" ItemsSource="{Binding Path=WorkItems}" Name="listView" HorizontalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Visible">
        <ListView.View>
          <GridView>
            <GridViewColumn Width="50" Header="Id" DisplayMemberBinding="{Binding Id}"  />
            <GridViewColumn Width="290" Header="Title" DisplayMemberBinding="{Binding Title}" />
            <GridViewColumn Width="90" Header="State" DisplayMemberBinding="{Binding State}" />
          </GridView>
        </ListView.View>
      </ListView>
      <StackPanel VerticalAlignment="Center" Name="progress" Visibility="Collapsed">
        <ProgressBar HorizontalAlignment="Center" IsIndeterminate="True" Margin="5" Width="100" Height="20"></ProgressBar>
        <TextBlock HorizontalAlignment="Center">Loading...</TextBlock>
      </StackPanel>
    </Grid>

    <StackPanel Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Right">
      <Button Margin="5" Width="75" IsDefault="True" Click="Button_ClickOk" HorizontalAlignment="Right">Ok</Button>
      <Button Margin="5" Width="75" Click="Button_ClickCancel" HorizontalAlignment="Right">Cancel</Button>
    </StackPanel>
    
  </Grid>
</Window>
